<?php get_header(); ?>

<?php 

$main = get_option( "sh_breaking-news-main" );

if ( $main == '' ) $main = 2;
if ( $subs == '' ) $subs = 3;

$subs = get_option( "sh_breaking-news-subs" );

?>
	<?php if (have_posts()) : ?>
		<div id="sidebarB">
			<?php while (have_posts()) : the_post(); $loopcount++; ?>
				<?php if ( $loopcount > $main AND $loopcount < ( $main + $subs + 1 ) ): ?>
					<div class="post" id="post-<?php the_ID(); ?>">
						<h2><?php the_title(); ?></h2>
						<?php the_excerpt(); ?>
						<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink: <?php the_title(); ?>"><em>More on page <?php echo $post->ID; ?></em></a></p>
					</div>
				<?php endif; ?>
			<?php endwhile; ?>
		</div>
		<?php rewind_posts(); ?>
		<div id="content">
			<?php while (have_posts()) : the_post(); $loop2count++; ?>
				<?php if( $loop2count < ( $main + 1 ) ) : ?>
					<div class="post" id="post-<?php the_ID(); ?>">
						<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
						<p class="details_small">
							<?php the_category(', ') ?> 
							<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
						</p>
						<?php the_content("<em>More on page " . $post->ID . "</em>"); ?>
						<p class="date"><?php the_author(); ?> @ <?php the_time('F j, Y') ?></p>
					</div>
				<?php endif; ?>
			<?php endwhile; ?>
		</div>
	<?php else : ?>
		<div id="sidebarB">
			<h2>Breaking News</h2>
			<ul>
				<?php wp_get_archives('type=postbypost&limit=15'); ?>
			</ul>
			<ul>
				<?php wp_list_bookmarks(); ?>
			</ul>
		</div>
		<div id="content">
			<h2>Not found</h2>
			<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
		</div>
	<?php endif; ?>
<?php get_footer(); ?>
